
<?

require_once ("application.list.inc");

global $_GLOBAL_DBH;
global $_OBJECT_IFACE_PANEL;

$indexes = array (
	phase_title=>array (label=>"Title",order=>"DEFAULT",wrapper=>"vmc_icon_phase",callback=>"_template_list_substring",length=>16),
	user_name=>array (label=>"Assigned User",order=>"DEFAULT",wrapper=>"vmc_icon_user"),
	status=>array (label=>"Status",order=>"DEFAULT",
		values=>array(
			"new"=>"New Phase",
			active=>"New Phase",
			active=>"New Phase",
			active=>"New Phase",
			active=>"New Phase",
		),
		wrapper=>"vmc_icon_status"),
	date_begin=>array (label=>"Date End",order=>"DEFAULT",wrapper=>"vmc_icon_time_in"),
	date_due=>array (label=>"Date Due",order=>"DEFAULT",wrapper=>"vmc_icon_total_time"),
);

$object_ctl = "/admin/projects/projects/fs_projects.php?fs_tab=phases&project_id={$_REQUEST["project_id"]}&fs_tab_option=fs_phases&fs_action=view&";
$link_options = "&fs_action=view&fs_tab=phases&project_id={$_REQUEST["project_id"]}";
$list_options = array (
	array (
		label=>"Select Project Phase",
		link=>"fs_projects.php?fs_tab=phases&project_id={$_REQUEST["project_id"]}&fs_tab_option=fs_phases&fs_action=addnew"
	),
);

$_OBJECT_IFACE_LIST = _app_create_list_object (array (
                db_conn=>$_GLOBAL_DBH,
                indexes=>$indexes,
		list_count=>"SELECT COUNT(*) FROM project_phases WHERE project_id={$_REQUEST["project_id"]}",
		list_select=>"SELECT project_phases.*,phases.title AS phase_title,(CASE assigned_id WHEN 0 THEN 'Unassigned' ELSE (SELECT CONCAT(last,', ',first) FROM users WHERE id=assigned_id) END) AS user_name FROM project_phases,phases WHERE project_id={$_REQUEST["project_id"]} AND phase_id=phases.id",
                list_id=>"lc_project_phases",
                list_options=>$list_options,
                primary_key=>"id",
                primary_relation=>"phase_id",
                link_options=>$link_options,
                object_ctl=>$object_ctl
));


$_OBJECT_IFACE_TABBING_PANEL->insert_container ($_OBJECT_IFACE_LIST);

?>
